@extends('layouts.admin')
@section('css')
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_page.css') }}" rel="stylesheet" />
  <link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_table.css') }}" rel="stylesheet">
  <link href="{{ asset('admin/assets/bootstrap-datepicker/css/datepicker.css') }}" rel="stylesheet">
  <link href="{{ asset('admin/assets/bootstrap-daterangepicker/daterangepicker-bs3.css') }}" rel="stylesheet">
@endsection
@section('content')
<section id="main-content">
          <section class="wrapper">
              <!-- page start-->
              <div class="row">
                  
                  <div class="col-lg-12">
                      <section class="panel">
                        <div class="panel-body">
                            <div class="btn-group mr10 pull-right">
                                <a href="{{ route('admin.assistant.articles.create') }}" class="btn btn-white tooltips"
                                   data-toggle="tooltip" data-original-title="新增"><i
                                            class="glyphicon glyphicon-plus"></i></a>
                                
                            
                        </div><!-- pull-right -->
                       
                          <header class="panel-heading">
                              平台公告
                          </header>
                          <div class="panel-body">
                                <div class="adv-table">

                                    <div class="panel-body right"  align="right">
                              
                             <form class="form-inline" action="{{ route('admin.assistant.articles') }}" role="form" method="get">
                                  {{ csrf_field() }}
                                  

                                  <div class="form-group">
                                      <label class="sr-only" for="exampleInputEmail2">用户名</label>
                                      <input type="text" class="form-control tooltips" id="title" data-toggle="tooltip" name="title" value="{{ $data['title'] }}" placeholder="输入标题">
                                  </div>
                              

                                  <div class="form-group "  >
                                      <!-- <label class="control-label col-md-3 sr-only">下单时间</label> -->
                                      <!-- <div class="col-md-4" > -->
                                          <!-- <div class="input-group input-large" data-date="13/07/2013" data-date-format="mm/dd/yyyy"> -->
                                              <input type="text" class="form-control dpd1" name="from" value="{{ $data['from'] }}" placeholder="开始日期">
                                              <!-- <span class="">To</span> -->
                                              <!-- <input type="text" class="form-control dpd2" name="to"> -->
                                          <!-- </div> -->
                                          <!-- <span class="help-block">Select date range</span> -->
                                      <!-- </div> -->
                                  </div>
                                  -
                                  <div class="form-group "  >
                                      <!-- <label class="control-label col-md-3 sr-only">下单时间</label> -->
                                      <!-- <div class="col-md-4" > -->
                                          <!-- <div class="input-group input-large" data-date="13/07/2013" data-date-format="mm/dd/yyyy"> -->
                                              <!-- <input type="text" class="form-control dpd1" name="from"> -->
                                              <!-- <span class="input-group-addon">To</span> -->
                                              <input type="text" class="form-control dpd2" name="to" value="{{ $data['to'] }}" placeholder="截止日期">
                                          <!-- </div> -->
                                          <!-- <span class="help-block">Select date range</span> -->
                                      <!-- </div> -->
                                  </div>

                                  <button type="submit" class="btn btn-info">搜索</button>
                              </form>

                          </div>

                                    <!-- <table  class="display table table-bordered table-striped" id="reply"> -->
                                     <table class="table table-striped table-advance table-hover">
                                      <thead>
                                      <tr>
                                          <th>
                                            <span class="ckbox ckbox-primary">
                                                <input type="checkbox" id="selectall"/>
                                                <label for="selectall"></label>
                                            </span>
                                        </th>
                                          <th>标题</th>
                                         <!--  <th>描述</th> -->
                                          <th>状态</th>
                                          <th class="">首页</th>
                                          <th class="">弹出</th>
                                          <th class="">封面</th>
                                          <th class="">排序</th>
                                          <th class="">创建时间</th>
                                          <th class="">更新时间</th>
                                          <th class="">操作</th>
                                      </tr>
                                      </thead>
                                      <tbody>
                                      @foreach($articles as $article)
                                      <tr class="gradeX">
                                          <td>
                                              <div class="ckbox ckbox-default">
                                                  <input type="checkbox" name="id" id="id-{{ $article->id }}"
                                                         value="{{ $article->id }}" class="selectall-item"/>
                                                  <label for="id-{{ $article->id }}"></label>
                                              </div>
                                          </td>
                                          <td>{{ $article->title }}</td>
                                          <!-- <td>{{ $article->description }}</td> -->
                                          <td>{{ $article->statusinfo() }}</td>
                                          <td>{{ $article->ishome() }}</td>
                                          <td>{{ $article->popup() }}</td>

                                          <td class="thumb p-thumb" >@if(!empty($article->cover))<img src="{{ asset($article->cover) }}" alt="" />@endif</td>
                                          <td class="">{{ $article->sort }}</td>
                                          <td class="">{{ $article->created_at }}</td>
                                          <td class="">{{ $article->updated_at }}</td>
                                          <td class="center hidden-phone">
                                               <a href="{{ route('admin.assistant.articles.edit',['id'=>$article->id]) }}"
                                               class="btn btn-primary btn-xs"><i class="icon-pencil"></i> </a>
                                            <a class="btn btn-danger btn-xs user-delete"
                                               data-href="{{ route('admin.assistant.articles.destroy',['id'=>$article->id]) }}">
                                                <i class="icon-trash"></i> </a>
                                          </td>
                                      </tr>
                                      @endforeach
                                      
                                
                                      <tfoot>
                                      
                                      </tfoot>
                          </table>
                                </div>
                                {!! $articles->appends($data)->links() !!}
                          </div>
                          </div>
                      </section>
                  </div>
              </div>
              <!-- page end-->
          </section>
      </section>
@endsection
@section('javascript')
<script type="text/javascript" language="javascript" src="{{ asset('admin/assets/advanced-datatable/media/js/jquery.dataTables.js') }}"></script>
<script type="text/javascript" src="{{ asset('admin/assets/bootstrap-datepicker/js/bootstrap-datepicker.js') }}"></script>
<script type="text/javascript" src="{{ asset('admin/assets/bootstrap-daterangepicker/daterangepicker.js') }}"></script>
 <script src="{{ asset('admin/js/advanced-form-components.js') }}"></script>
<script type="text/javascript" language="javascript" src="{{ asset('admin/assets/advanced-datatable/media/js/jquery.dataTables.js') }}"></script>
 <script type="text/javascript" charset="utf-8">
      $(document).ready(function() {
          $('#reply').dataTable( {
              "aaSorting": [[ 4, "desc" ]],
              "oLanguage": {
                   "oPaginate": {
                     "sLast": "最后一页",
                     "sNext":"下页",
                     "sPrevious":"上页",
                     "sEmptyTable":"表里没有数据",
                   },
                   "sInfo": " _START_ - _END_ / _TOTAL_ 条记录",
                   "sLengthMenu": "显示 _MENU_ 条记录",
                   "sSearch": "搜索:",
                 }
          } );
      } );


        $(".user-delete").click(function () {
            Rbac.ajax.delete({
                type:'delete',
                data:{"_token" : "{{ csrf_token() }}" },
                confirmTitle: '确定删除该公告吗?',
                href: $(this).data('href'),
                successTitle: '删除成功'
            });
        });

        $(".deleteall").click(function () {
            Rbac.ajax.deleteAll({
                confirmTitle: '确定删除选中的公告?',
                href: $(this).data('href'),
                successTitle: '删除成功'
            });
        });
    
      
  </script>  
@endsection

